<?php
/**
 * Component Mail box Configuration
 * 
 * 
 */
use Fox\Html\DropList;
use Fox\Html\Wrapper;
use Fox\Generator;
use Fox\Html\Button\Help;
use Fox\Html\CheckBox;
use Fox\Html\Button;
use Hive\Customizing;
use Fox\Html\Input;
use Fox\Html\Screen;
use Fox\Html\Block;

$appName = Customizing::instance()->applicationName();

$wrapper = new Wrapper('wConfig','');

$block = new Block('bConfiguration');
$block->noLegend();
$block->add(new Input('name',true,User::current()->name()))
		->size(Input::SIZE_MEDIUM);
$block->add(new Input('email',true))->size(Input::SIZE_LARGE);
$block->add(new Input(array('usrnm','username'),false))->size(Input::SIZE_LARGE)
			->hidden(true);
/*
$block->add(new Input(array('passw','password'),true))
			->inputType('password')
			->size(Input::SIZE_MEDIUM);
*/
$wrapper->add($block);	
// Server / Hostnames and Ports
$blEmission = new Block('bEmission',
						Msg(Orx\Mailer\Messages::BUNDLE,Orx\Mailer\Messages::MESSAGE_SENDING_LABEL));
// Options Use SLL
$smptPorts = array(25 => 25,465 => 465,587 => 587);
	
$blEmission->add(new Input(array('smtp_host','smtp'),false))->size(Input::SIZE_LARGE)
			
			->label('<em style="display:inline">*</em>',false,Input::LABEL_ADD_AFTER)
			->add(new DropList('smtp_port',false,false,true,587))
				->options($smptPorts)
				->size('auto')
				->labelHasPlaceHolder()
				->noLabel()
				;
// Options Use SLL
$typeOfConnections = array(
	'tls' => Msg(Orx\Mailer\Messages::BUNDLE,Orx\Mailer\Messages::CONNECTION_TLS),
	'ssl' => Msg(Orx\Mailer\Messages::BUNDLE,Orx\Mailer\Messages::CONNECTION_SSL),
	'' 	  => Msg(Orx\Mailer\Messages::BUNDLE,Orx\Mailer\Messages::CONNECTION_UNSECURED)
);
$blEmission->add(new DropList\Radio('smtp_connection_mode',false,false,'tls'))
		->renderingMode(CheckBox::RMODE_VERTICAL)
		->label(' ')
		->options($typeOfConnections);				
										
$wrapper->add($blEmission);
$blReception = new Block('bReception',
						Msg(Orx\Mailer\Messages::BUNDLE,Orx\Mailer\Messages::MESSAGE_RECOVERY_LABEL));
$blReception->add(new Input(array('imap_host','imap'),false))->size(Input::SIZE_LARGE)
			
			->label('<em style="display:inline">*</em>',false,Input::LABEL_ADD_AFTER)
			->add(new Input('imap_port',false,null))
				->labelHasPlaceHolder()
				->noLabel()
				;	
$blReception->add(new Input(array('pop3_host','pop3'),false))->size(Input::SIZE_LARGE)
			
			->label('<em style="display:inline">*</em>',false,Input::LABEL_ADD_AFTER)
			->add(new Input('pop3_port',false,null))
				->labelHasPlaceHolder()
				->noLabel()
				;
// Options Use SLL
$blReception->add(new CheckBox('usessl'))
		->renderingMode(CheckBox::RMODE_LABEL_RIGHT_WO_MARGIN)
		->label(Msg(Orx\Mailer\Messages::BUNDLE,
					Orx\Mailer\Messages::ALWAYS_USE_SSL
				))
		->helpMessage(Msg(Orx\Mailer\Messages::BUNDLE,
					Orx\Mailer\Messages::ALWAYS_USE_SSL_HELP
				));
				
// Options Keep Email Copy
$blReception->add(new CheckBox('keepacopy',true))
		->renderingMode(CheckBox::RMODE_LABEL_RIGHT_WO_MARGIN)
		->label(Msg(Orx\Mailer\Messages::BUNDLE,
					Orx\Mailer\Messages::KEEP_A_COPY_OF_EMAIL
				))
		->helpMessage(Msg(Orx\Mailer\Messages::BUNDLE,
					Orx\Mailer\Messages::KEEP_A_COPY_OF_EMAIL_HELP,
					$appName
				));
$wrapper->add($blReception);
return $wrapper;